<template>
  <ContentWrap>
      <!-- 搜索工作栏 -->
      <el-form
        class="-mb-15px"
        :model="queryParams"
        ref="queryFormRef"
        :inline="true"
        label-width="100px"
      >
        <el-form-item label="产品编号" prop="productCode ">
          <el-input
            v-model="queryParams.productCode "
            placeholder="请输入产品编号"
            clearable
            class="!w-240px"
            @keyup.enter="handleQuery"
          />
        </el-form-item>
        <el-form-item label="称重日期" prop="dateReq">
          <el-date-picker
            v-model="queryParams.dateReq"
            value-format="YYYY-MM-DD HH:mm:ss"
            type="datetimerange"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            class="!w-400px"
          />
        </el-form-item>
        <el-form-item>
          <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
          <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
        </el-form-item>
      </el-form>
    </ContentWrap>
  <!-- 列表 -->
  <ContentWrap>
      <el-table v-loading="loading" :data="list">
        <el-table-column type="index" label="序号" align="center" width="55" />
        <el-table-column label="产品编号" align="center" prop="productCode" />
<!--        <el-table-column label="产品名称" align="center" prop="productName" />-->
        <el-table-column label="称重日期" align="center" prop="balanceTwiceTime" />
        <!-- <el-table-column label="上线类型" align="center" prop="id" /> -->
        <el-table-column label="称重" align="center" prop="weight" />
        <el-table-column label="刚性测试结果" align="center" prop="rigidity" />
        <el-table-column label="平衡测试结果" align="center" prop="balance" />
        <el-table-column label="织板编码" align="center" prop="materialCode" />
        <el-table-column label="批次号" align="center" prop="batchCode" />
        <el-table-column label="订单号" align="center" prop="orderCode" />
        <el-table-column label="供应商" align="center" prop="supplierName" />
        <el-table-column label="出库时间" align="center" prop="deliveryTime" />
        <el-table-column label="入库时间" align="center" prop="receiptTime" />
<!--        <el-table-column label="出入库操作员" align="center" prop="operator" />-->
      </el-table>
      <!-- 分页 -->
      <Pagination
        :total="total"
        v-model:page="queryParams.pageNo"
        v-model:limit="queryParams.pageSize"
        @pagination="getList"
      />
    </ContentWrap>
    <!-- 用户导入对话框 -->
    <supplierImportForm ref="importFormRef" @success="getList" />
  </template>
  
  <script lang="ts" setup>
  import * as finshProJournalApi from '@/api/hcxly/finshProJournal/Index'
  
  defineOptions({ name: 'finshProJournal' })
  
  const message = useMessage() // 消息弹窗
  const { t } = useI18n() // 国际化
  
  const loading = ref(true) // 列表的加载中
  const total = ref(0) // 列表的总页数
  const list = ref([]) // 列表的数据

  const queryParams = reactive({
    pageNo: 1,
    pageSize: 10,
    productCode : '',
    dateReq: null
  })
  const queryFormRef = ref() // 搜索的表单
  const exportLoading = ref(false) // 导出的加载中
  
  /** 查询列表 */
  const getList = async () => {
    loading.value = true
    try {
      const data = await finshProJournalApi.getfinshProJournal(queryParams)
      console.log(data)
      list.value = data.list
      total.value = data.total
    } finally {
      loading.value = false
    }
  }
  
  /** 搜索按钮操作 */
  const handleQuery = () => {
    queryParams.pageNo = 1
    getList()
  }
  
  /** 重置按钮操作 */
  const resetQuery = () => {
    queryFormRef.value.resetFields()
    handleQuery()
  }

  /** 初始化 **/
  onMounted(() => {
    getList()
  })
  
  </script>
